//
//  BBBaseViewModel.h
//  goodsOwner
//
//  Created by apple on 2019/6/28.
//  Copyright © 2019年 fandecai. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "UIView+Frame.h"
#import <Masonry.h>


/**
 设置UIView的属性
 methodName 属性名
 paraType 属性
 selfClass 返回类型（一般是单前对象）
 */
#define BBKIT_SETPRAGRA_API(methodName, paraType,UiType, selfClass) \
- (selfClass (^)(paraType param))methodName{\
return ^(paraType param){\
((UiType *)self.view).methodName = param;\
return self;\
};\
}


/**
 设置UIView的layer属性
 methodName 属性名
 paraType 属性类型
 */
#define BBKIT_SETPRAGRA_LAYER_API(methodName, paraType) \
- (BBBaseViewModel * (^)(paraType param))methodName{\
return ^(paraType param){\
self.view.layer.methodName = param;\
return self;\
};\
}




NS_ASSUME_NONNULL_BEGIN



@interface BBBaseViewModel : NSObject

/// 视图的唯一标示
@property (nonatomic, assign, readonly) NSInteger tag;

/// 视图的唯一标示
@property (nonatomic, strong, readonly) __kindof UIView *view;

@property (nonatomic, assign, readonly) Class viewClass;

- (instancetype)initWithTag:(NSInteger)tag andView:(__kindof UIView *)view;

#pragma mark - # 基本属性
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^frame)(CGRect frame);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ origin)(CGPoint origin);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ x)(CGFloat x);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ y)(CGFloat y);

@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ size)(CGSize size);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ width)(CGFloat width);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ height)(CGFloat height);

@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ center)(CGPoint center);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ centerX)(CGFloat centerX);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ centerY)(CGFloat centerY);

@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ top)(CGFloat top);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ bottom)(CGFloat bottom);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ left)(CGFloat left);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ right)(CGFloat right);

#pragma mark - # Layout
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ masonry)( void (^constraints)(MASConstraintMaker *make) );
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ updateMasonry)( void (^constraints)(MASConstraintMaker *make) );
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ remakeMasonry)( void (^constraints)(MASConstraintMaker *make) );

#pragma mark - # Color
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ backgroundColor)(UIColor *backgroundColor);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ tintColor)(UIColor *tintColor);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ alpha)(CGFloat alpha);

#pragma mark - # Control
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ contentMode)(UIViewContentMode contentMode);

@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ opaque)(BOOL opaque);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ hidden)(BOOL hidden);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ clipsToBounds)(BOOL clipsToBounds);

@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ userInteractionEnabled)(BOOL userInteractionEnabled);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ multipleTouchEnabled)(BOOL multipleTouchEnabled);

#pragma mark - # Layer
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ masksToBounds)(BOOL masksToBounds);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ cornerRadius)(CGFloat cornerRadius);

@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ border)(CGFloat borderWidth, UIColor *borderColor);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ borderWidth)(CGFloat borderWidth);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ borderColor)(CGColorRef borderColor);

@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ zPosition)(CGFloat zPosition);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ anchorPoint)(CGPoint anchorPoint);

/** 设置阴影*/
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ shadow)(CGSize shadowOffset, CGFloat shadowRadius, UIColor *shadowColor, CGFloat shadowOpacity);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ shadowColor)(CGColorRef shadowColor);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ shadowOpacity)(CGFloat shadowOpacity);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ shadowOffset)(CGSize shadowOffset);
@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ shadowRadius)(CGFloat shadowRadius);

@property(nonatomic,strong,readonly)   BBBaseViewModel* (^ transform)(CATransform3D transform);

@end

NS_ASSUME_NONNULL_END
